import { combineReducers } from 'redux';

//The auth reducer. The starting state sets authentication
//based on a token being in local storage
function auth(state = {
  isFetching: false,
  isAuthenticated: !!localStorage.getItem('id_token')
}, action = {}) {
  switch (action.type) {
//     case LOGIN_REQUEST:
//       return { ...state,
// isFetching: true,
//         isAuthenticated: false,
//         user: action.creds };
//     case LOGIN_SUCCESS:
//       return { ...state,
// isFetching: false,
//         isAuthenticated: true,
//         errorMessage: '' };
//     case LOGIN_FAILURE:
//       return { ...state,
// isFetching: false,
//         isAuthenticated: false,
//         errorMessage: action.message };
//     case LOGOUT_SUCCESS:
//       return { ...state,
// isFetching: true,
//         isAuthenticated: false };
    default:
      return state;
  }
}

function quotes(state = {}, action = {}) {
  switch (action.type) {
    default:
      return state;
  }
}

//combine the reducers
const tiweApp = combineReducers({
  auth,
  quotes
});

export default tiweApp;
